<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:t="http://myfaces.apache.org/tomahawk"
	template="/pages/template/main-layout.xhtml">

	<ui:define name="content">
		<t:saveState value="#{evokQtnaireRoleBean.role}" />
		<h:panelGrid cellpadding="5" width="100%" columns="2" columnClasses="width30,width70">
			<p:panel header="#{msgs.role_title}">
				<p:dataTable id="data" var="ci" value="#{evokQtnaireRoleBean.roleModel}" rowKey="#{ci.id}"
					selectionMode="single">
					<p:ajax event="rowSelect" listener="#{evokQtnaireRoleBean.onRowSelect}" update=":mainform:roleInfo" />

					<p:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.default_name}" />
						</f:facet>
						<h:outputText value="#{ci.name}" />
					</p:column>
				</p:dataTable>
			</p:panel>

			<h:panelGroup id="roleInfo" style="width:90%;">
				<p:tree value="#{evokQtnaireRoleBean.rootQtnaire}" var="node" selection="#{evokQtnaireRoleBean.selectedQtnaires}"
					selectionMode="checkbox" style="background:none; width:100%;">
					<p:treeNode>
						<h:outputText value="#{node.code} - #{node.name}" />
					</p:treeNode>
				</p:tree>
				<br />
				<h:panelGroup>
					<p:commandButton onclick="return validator('mainform');" value="#{msgs.button_submit}"
						style="float:right" icon="ui-icon-disk" update="roleInfo,data,:messages"
						actionListener="#{evokQtnaireRoleBean.submit}" />
				</h:panelGroup>
			</h:panelGroup>
		</h:panelGrid>
	</ui:define>
</ui:composition>
